import React, { useState } from 'react';
import TypeEffect from '../src/react';

const Example = () => {
  const [text, setText] = useState('Hello, this is a typing effect like ChatGPT!');

  const handleTypingDone = () => {
    console.log('Typing completed!');
  };

  const changeText = () => {
    setText('This is a new text to demonstrate the typing effect again.');
  };

  return (
    <div className="example">
      <h1>React TypeEffect Example</h1>
      <TypeEffect 
        text={text} 
        speed={30} 
        showCursor={true}
        onTypingDone={handleTypingDone}
      />
      <button onClick={changeText}>Change Text</button>
    </div>
  );
};

export default Example;